<!--
  @author tanghongjun
  @since 2018/10/19 08:59
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head th:include="common/common :: jscss">
    <title>产品描述</title>
</head>
<body>
<div class="layui-fluid">
    <blockquote class="layui-crumb">
        后台产品>产品管理>
        <a lay-href="/product/list.action">后台产品管理</a>>
        <a th:href="'/product/addEditView.action?productId='+${servProductVO.productId}">[[${servProductVO.name}]]</a>>
        <zmn>产品描述</zmn>
    </blockquote>

    <div class="layui-card">
        <div th:replace="product/_tab::tab"></div>

        <div class="layui-card-body">
            <form method="post" action="" class="layui-form" lay-filter="zmn-form">
                <input type="hidden" name="productId" th:value="${servProductVO.productId}"/>
                <div class="layui-form-item">
                    <script id="productDesc" width="900px" height="500px" name="productDesc" type="text/plain">
                    </script>
                </div>

                <div class="layui-split">&nbsp;</div>
                <div class="layui-form-item submit">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit="" lay-filter="zmn-form-submit">
                            提交
                        </button>
                        <a href="/product/list.ation" class="layui-btn" text="取消">取消</a>
                    </div>
                </div>

            </form>
        </div>
    </div>
</div>

</body>
</html>

<script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.all.js"></script>
<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="/static/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" th:inline="javascript">
    var ue = UE.getEditor('productDesc', {
        initialFrameHeight:500,
        initialFrameWidth:900
    });

    UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
    UE.Editor.prototype.getActionUrl = function(action) {
        // 这里很重要，很重要，很重要，要和配置中的imageActionName值一样
        if (action == 'uploadimage') {
            // 这里调用后端我们写的图片上传接口
            return '/ueditor/uploadImageData';
        } else {
            return this._bkGetActionUrl.call(this, action);
        }
    }

    let value = [[${servProductVO.productDesc}]];
    ue.ready(function () {
        ue.execCommand('insertHtml', value);
    });
</script>

<script type="text/javascript">
    function insertHtml() {
        var value = prompt('插入html代码', '');
        UE.getEditor('productDesc').execCommand('insertHtml', value)
    }

    function getContent() {
        var arr = [];
        arr.push(UE.getEditor('productDesc').getContent());
        return(arr.join("\n"));
    }
</script>

<script type="text/javascript" th:inline="javascript">
    var json = {
        servProductVO: [[${servProductVO}]]
    };
    layui.config({
        base: "/static/lay/",
        version:2019092600000
    }).extend({
        index: "lib/index",
        product_desc_edit_js: "product/zmn.plat.product.desc.edit"
    }).use(['index', 'product_desc_edit_js']);
</script>